package com.qhw.jdbc;

import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class AppJdbcUpdate {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.cj.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/test?useSSL=false";
        String name = "root";
        String password = "password";
        Connection connection = DriverManager.getConnection(url, name, password);
        Statement statement = connection.createStatement();
        String sql = "update `user` set `username` = 'LBW'  where id = 1";
        int i = statement.executeUpdate(sql);
        if (i == 1)
            System.out.println("修改成功！");
    }
}
